#include "command.h"
#include <iostream>

CommandQueue::CommandQueue() : MutuallyExclusive()
{
	this->queue = Queue();
}

void CommandQueue::addCommand(RawCmd cmd)
{
	if (cmd.isValid)
	{
		this->queue.push_back(cmd);
	}
}

Queue CommandQueue::getQueue()
{
	Queue que = Queue();

	if (this->wait(INFINITE) == WAIT_OBJECT_0)
	{
		que = this->queue;

		this->queue.clear();

		this->release();
	}

	return que;
}